package cn.itsource.system.service.impl;

import cn.itsource.basic.service.impl.BaseServiceImpl;
import cn.itsource.system.domain.SystemDictionaryDetail;
import cn.itsource.system.domain.SystemDictionaryType;
import cn.itsource.system.mapper.SystemDictionaryDetailMapper;
import cn.itsource.system.service.ISystemDictionaryTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @description: 业务实现类：数据字典类型
 * @author: Bug修复机
 * @date: 2022/8/12 : 19:21
 * @version: ver1.0
 * @email tangli@itsource.cn
 */
@Service //1.将当前类交给Spring管理 2.实例化对象的注解 //前提：扫描包路径
public class SystemDictionaryTypeServiceImpl extends BaseServiceImpl<SystemDictionaryType> implements ISystemDictionaryTypeService {

    @Autowired
    private SystemDictionaryDetailMapper systemDictionaryDetailMapper;

    @Transactional
    @Override
    public void remove(Long id) {
        //删除数据字典类型
        super.remove(id);
        //根据类型id删除数据字典明细
        systemDictionaryDetailMapper.removeByTypeId(id);
    }

    @Override
    public void patchRemove(List<Long> ids) {
        //删除数据字典类型
        super.patchRemove(ids);
        //根据类型id批量删除数据字典明细
        systemDictionaryDetailMapper.patchRemoveByTypeId(ids);
    }
}
